Skip to content

fix(studio): make command palette shortcut platform-aware - #889

Closed
Tanmaypatil-25 wants to merge 1 commit into
d-oit:mainfrom
Tanmaypatil-25:fix/platform-aware-command-shortcut
Closed

Tanmaypatil-25 wants to merge 1 commit into
d-oit:mainfrom
Tanmaypatil-25:fix/platform-aware-command-shortcut

Conversation

@Tanmaypatil-25

@Tanmaypatil-25 Tanmaypatil-25 commented Oct 1, 2026 •

Copy link
Copy Markdown

Summary

Fixes the command palette shortcut hint so that it displays the appropriate keyboard shortcut based on the user's platform.

  • Displays ⌘K on macOS.
  • Displays Ctrl+K on Windows and Linux.
  • Adds a shared platform utility to keep the shortcut label consistent.
  • Updates both the sidebar and topbar command palette triggers.

Changes

  • Added COMMAND_PALETTE_SHORTCUT_LABEL in src/lib/studio/platform.ts.
  • Replaced the hardcoded ⌘K label in sidebar.tsx.
  • Replaced the hardcoded ⌘K label in topbar.tsx.

Testing

Local dependency installation could not be completed because onnxruntime-node failed during package extraction with a Node.js out-of-memory error on Windows.

The change is limited to the platform-aware shortcut label and does not modify the existing command palette keyboard handler.

Closes #872


📝 Summary by GitNexus

Summary

A focused Studio UI change to the command palette shortcut carries a critical blast-radius classification.

🔴 CRITICAL blast radius. This makes the command palette shortcut platform-aware in the Studio UI, with impact reaching direct and second-hop dependents.

The change touches Sidebar and NavItem in src/components/studio/sidebar.tsx, Topbar in src/components/studio/topbar.tsx, and src/lib/studio/platform.ts. The graph places the impact in the Studio module and traces it through 12 affected flows.

Review the shortcut handling across the sidebar and topbar alongside the platform logic in platform.ts. The file risk level is LOW, with no HIGH or CRITICAL risk files identified.

Added by GitNexus for PR #889. Edit freely — this block is replaced on the next review, everything above it is left untouched.

@vercel

vercel Bot commented Oct 1, 2026

Copy link
Copy Markdown

@Tanmaypatil-25 is attempting to deploy a commit to the doit's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added the config label Oct 1, 2026
@nexus-check

nexus-check Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor
Akon Labs

GitNexus Review · PR #889

1 issue found across 3 files.

Summary

A focused Studio UI change to the command palette shortcut carries a critical blast-radius classification.

🔴 CRITICAL blast radius. This makes the command palette shortcut platform-aware in the Studio UI, with impact reaching direct and second-hop dependents.

The change touches Sidebar and NavItem in src/components/studio/sidebar.tsx, Topbar in src/components/studio/topbar.tsx, and src/lib/studio/platform.ts. The graph places the impact in the Studio module and traces it through 12 affected flows.

Review the shortcut handling across the sidebar and topbar alongside the platform logic in platform.ts. The file risk level is LOW, with no HIGH or CRITICAL risk files identified.

Full detail lives in the GitNexus check run for this commit.

@nexus-check

nexus-check Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

🤖 Agent context for GitNexus Review · PR #889

This comment carries deterministic graph detail for coding agents and reviewers who want the receipts — the main review comment carries the human summary.

🔴 CRITICAL blast radius — this change reaches 2 downstream symbols across 1 module; this lands on a critical surface, so review the dependents carefully before merging. (driven by dependent/module count, not file risk)

Blast Level Dependents Modules Files
🔴 CRITICAL 2 1 3

What changed

Symbol Changes (3)
Kind Symbol Location
Function Sidebar src/components/studio/sidebar.tsx:178
Interface NavItem src/components/studio/sidebar.tsx:32
Function Topbar src/components/studio/topbar.tsx:28
Changed Files (3)
File Status
src/components/studio/sidebar.tsx 🟡 modified
src/components/studio/topbar.tsx 🟡 modified
src/lib/studio/platform.ts 🟢 added

What it affects

Architecture Impact

Module Hits Direct
Studio 4 🟢

Blast Radius

Depth Count
d1 (direct) 1
d2 (indirect) 1
d3 (transitive) 0
Direct dependents (d1)
  • src/components/studio/app-shell.tsx:219 · AppShell
Indirect dependents (d2)
  • src/app/page.tsx:5 · Home
Prompt for AI agents (1 issue)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.

<file name="src/components/studio/sidebar.tsx">

<violation number="1" location="src/components/studio/sidebar.tsx:217">
P2: Platform-specific shortcut label differs during server rendering and hydration — 'COMMAND_PALETTE_SHORTCUT_LABEL' is evaluated in 'platform.ts' as 'Ctrl+K' when 'navigator' is unavailable, but evaluates as '⌘K' in a Mac browser. 'Sidebar' renders this constant at this line, and 'AppShell' renders 'Sidebar' directly ('app-shell.tsx:267'); the app entry renders 'AppShell' ('page.tsx:7') without a client-only/SSR-disabled wrapper. Thus a Mac receives different server and initial client text for this element, causing a hydration mismatch instead of matching markup.
</violation>

</file>

@codacy-production

Copy link
Copy Markdown
Contributor

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

<span className="flex-1">Search…</span>
<kbd className="rounded border border-border bg-muted px-1.5 py-0.5 font-mono text-caption text-ink-faint">
⌘K
{COMMAND_PALETTE_SHORTCUT_LABEL}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning — Platform-specific shortcut label differs during server rendering and hydration

COMMAND_PALETTE_SHORTCUT_LABEL is evaluated in platform.ts as Ctrl+K when navigator is unavailable, but evaluates as ⌘K in a Mac browser. Sidebar renders this constant at this line, and AppShell renders Sidebar directly (app-shell.tsx:267); the app entry renders AppShell (page.tsx:7) without a client-only/SSR-disabled wrapper. Thus a Mac receives different server and initial client text for this element, causing a hydration mismatch instead of matching markup.

(the same fix applies at src/components/studio/topbar.tsx:128, src/lib/studio/platform.ts:2)

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/components/studio/sidebar.tsx, line 217:

<comment>'COMMAND_PALETTE_SHORTCUT_LABEL' is evaluated in 'platform.ts' as 'Ctrl+K' when 'navigator' is unavailable, but evaluates as '⌘K' in a Mac browser. 'Sidebar' renders this constant at this line, and 'AppShell' renders 'Sidebar' directly ('app-shell.tsx:267'); the app entry renders 'AppShell' ('page.tsx:7') without a client-only/SSR-disabled wrapper. Thus a Mac receives different server and initial client text for this element, causing a hydration mismatch instead of matching markup.</comment>

<context>Enclosing symbol: Sidebar.</context>

Why this matters: GitNexus flagged this from your code graph — a caller or contract relies on what changed here. · llm-review

@d-oit d-oit left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for picking up #872 — the fix is the right shape, but it cannot merge as-is.

Blocking:

  1. Hydration mismatch (P1). COMMAND_PALETTE_SHORTCUT_LABEL is computed at module scope (src/lib/studio/platform.ts:1-4). The studio is server-rendered (src/app/page.tsx:7 → AppShell → Sidebar/Topbar), so Node SSR sees navigator === undefined and emits Ctrl+K; on macOS the client hydrates ⌘K, producing a React hydration mismatch on first load. The GitNexus thread flagged the same issue on sidebar.tsx. Please defer detection to the client (useEffect / useSyncExternalStore with a server snapshot, or render a neutral label until mounted) instead of a module-level constant.
  2. Deprecated API. navigator.platform is deprecated (WHATWG/MDN). Prefer navigator.userAgentData?.platform ?? navigator.platform (or fall back to navigator.userAgent) so the label survives the removal.
  3. Test. Please add a tiny unit test covering both label branches next to the helper.

Not blocking: Vercel fails because fork deployments need team authorization — not a code problem. Since this is a first-time contribution, the CI workflows are also gated (action_required); after you push the fixup, ping here and a maintainer will approve the workflow run so the full gate (units + e2e + Codacy) executes.

@d-oit

d-oit commented Oct 2, 2026

Copy link
Copy Markdown
Owner

Closing as superseded: #891 (merged as 08fe322) landed src/lib/studio/platform.ts with formatShortcut, wiring it into the topbar chip, sidebar kbd, and the shortcuts dialog, plus unit tests — so #872 is fixed on main and this PR can no longer change the codebase.

Thanks for the clean, focused fix @Tanmaypatil-25 — the approach here was right, and the review findings (module-scope platform detection is SSR-unsafe; navigator.platform is deprecated) apply to the merged implementation as well, so they are being tracked as a follow-up rather than lost.

@d-oit d-oit closed this Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ux] ⌘K hint shown to Windows/Linux users — make the shortcut chip platform-aware

2 participants